When money shall have been deposited under Section 15-17-240, if it remain on deposit at the time of an order or judgment for the payment of money to the plaintiff, the clerk shall, under the direction of the court, apply such deposit to the satisfaction thereof and after satisfying the judgment shall refund the surplus, if any, to the defendant. If the judgment be in favor of the defendant the clerk shall refund to him the whole sum deposited and remaining unapplied.
S.C. Code § 15-17-760