In all cases where judgment is rendered upon any instrument in writing in which two or more persons are severally bound, and it shall be made to appear to the court, by parol or other testimony, that one or more of said persons so bound signed the same as surety or bail for his codefendant, the court must in entering the judgment thereon state which of the defendants is principal debtor and which are sureties or bail. An execution issued on such judgment must command the sheriff or other officer to cause the money to be made out of the property of the principal debtor, but, for want of sufficient property of the principal debtor to make the same, to cause the same to be made out of the property of the surety or bail. In all cases the property, both real and personal, of the principal debtor, within the jurisdiction of the court must be exhausted before any of the property of the surety or bail shall be taken in execution.
SDCL 15-18-12