Section 45. In contested cases before a probate court or before the supreme judicial court on appeal, costs and expenses in the discretion of the court may be awarded to either party, to be paid by the other, or may be awarded to either or both parties to be paid out of the estate which is the subject of the controversy, as justice and equity may require. In any case wherein costs and expenses, or either, may be awarded hereunder to a party, they may be awarded to his counsel or may be apportioned between them. Execution may issue for costs awarded hereunder.