I came across this teshuva while preparing my weekly shiur on Ramban - it is based in part on a Ramban from parashat Vayakhel.
The Chatam Sofer was asked whether one is allowed to use candles from a house of idolatry (which I am going to assume is referring to a church), and whether they could be used in a shul. He split the question between candles that belonged to the church but had not been used, and those that had been used, then extinguished.
In terms of candles that were merely owned by the church, the Chatam Sofer ruled that they could definitely be used in a shul, since the mere designation of the candles as church candles was not sufficient to make it forbidden. Furthermore, since it would only be used for decorative purposes, and since the selling of the candles by the church would constitute a nullification of their idolatrous nature, they certainly could be used in shul.
However, would it be permissible to take a half-used church candle, melt it down, and then reconstitute it and use it in a shul? The Chatam Sofer begins by noting that according to the Shulchan Aruch one should not take the clothes of a priest and turn them into a tallit, as that small amount of tailoring would constitute a sufficient shinui to allow the sacramental clothing to be used for a mitzva. However, he feels that the melting down of a candle and subsequent re-rendering of it as a new candle would be a sufficient shinui and such a thing would be allowed.
However, he wonders if the Ramban in parashat Vayakhel militates against this. In discussing the kiyor (laver), the Midrash states that Moshe did not want to accept the women's mirrors to be used in its construction, since they were used for vanity purposes and thus had no place in the Mishkan. However, Hashem noted that they were in fact tools of shalom bayit and thus should be accepted (see Rashi on Shemot 38:8 for further detail). Ramban wonders why this was such a problem - after all, Moshe had no problem in accepting other jewelry from the women, but notable the kumaz, which according to the Midrash was an accessory worn on a woman's genitals! Why was Moshe not repulsed by accepting such an object!?
According to Ramban, since the kumaz was given along with many other types of jewelry, it was batel (nullified) in the mixture with the other accessories. The Chatam Sofer notes that the more logical explanation would be to say that since the jewelry was all melted down, the kumaz was not a problem, whereas the mirrors, which were not melted down, remained troublesome to Moshe. However, Ramban does not take that approach, and the Chatam Sofer reasons that according to Ramban, merely melting down something does not eradicate its repulsive nature. Applied to our question, that would mean that melting down the candles would not eliminate their stigma of having come from a church.
However, the Chatam Sofer disagrees with this approach (and a Gemara in Avoda Zara 52b which seems to make a similar point), and he permits using such candles under such circumstances. However, he notes that one who wants to be strict and not use such candles will be blessed from steering clear of objects that once were a part of foreign worship.