In all cases where it shall appear to the court that any person who is not present nor represented at the hearing should be protected in his right to have any communication made under the confidential relations provisions of §§ 19-19-502 to 19-19-505, inclusive, and § 19-19-508, excluded, it shall be the duty of the court to make such objections and orders for such purpose as to the court may seem necessary.
SDCL 19-2-9