(a) Unless the sealed envelope or wrapper is returned to the custodian who is to appear personally, the copy of the records shall remain sealed and shall be opened only at the time of trial, deposition, or other hearing, upon the direction of the judge, court, officer, body, or tribunal conducting the proceeding, in the presence of all parties who have appeared in person or by counsel at such trial, deposition, or hearing. Before directing that the inner envelope or wrapper be opened, the judge, court, officer, body, or tribunal shall first ascertain that either:
(1) The records have been subpoenaed at the instance of the patient involved or his counsel of record; or
(2) The patient involved or someone authorized in his behalf to do so for him has consented thereto and waived any privilege of confidentiality involved.
(b) Records which are not introduced in evidence or required as part of the record shall be returned to the person or entity from whom received.