If it appears that a defendant or the state is prejudiced by a joinder of offenses or of defendants in an indictment or information or by such joinder for trial together, the court may order an election or separate trials of counts, grant a severance of defendants or provide whatever other relief justice requires. In ruling on a motion by a defendant for severance the court may order the prosecuting attorney to deliver to the court for inspection in camera any statements or confessions made by the defendants which the state intends to introduce in evidence at the trial.
SDCL 23A-11-2