From: Rabbi Moshe Sofer
To: Rabbi Elyakim Getz Konigsberg
Rabbi Getz asks whether a crumbling synagogue may be demolished to build a new one, and how to handle Holy Names inscribed on its walls. The Chasam Sofer permits immediate demolition when the structure is in danger of collapse, ruling that the only concern is ensuring reconstruction proceeds. Holy Names on the plaster should be carefully peeled off and placed in genizah.
Source: Shu"t Chasam Sofer OC §33