Upon a sufficient showing the court may at any time order that the discovery or inspection be denied, restricted, or deferred, or make such other order as is appropriate. Upon motion by a party, the court may permit the party to make such showing, in whole or in part, in the form of a written statement to be inspected by the judge alone. If the court enters an order granting relief following such ex parte showing, the entire text of the party's statement shall be sealed and preserved in the records of the court to be made available to the appellate court in the event of an appeal.
SDCL 23A-13-16