As part of the decree or judgment entered in any action commenced under §§ 43-25-18.1 to 43-25-18.6, inclusive, the court may require that the real property be sold and that the proceeds from the sale be used for similar religious, educational, charitable, benevolent, or public purposes as provided in the original conveyance, and that the condition subsequent contained in the original conveyance attach to the sale proceeds upon such terms and conditions as the court may determine. The court may also require that the sale proceeds be used to purchase other real property or be put to such other uses consistent with the condition subsequent as the court determines.
SDCL 43-25-18.5