If such consent is not given, filed, and entered as provided in section 32-16-27 at or before a judgment of sale is rendered, the court must ascertain and determine what proportion of the proceeds of the sale, after deducting expenses, will be a just and reasonable sum to be allowed on account of such estate, and must order the same to be paid to such party or deposited in court for that party, as the case may require.