The Rema paskens (YD 276:10) in the name of the Terumas HaDeshen that one can only erase Shem Hashem written (usually in Siddurim) as two letter “Yud”s if really necessary. The Shevet HaKehosi (4:256b) says that if the letters Dalet or Hey are used to indicate Hashem’s name, you are permitted to erase it. He brings a “Raya” from the Tosfos in Shevuos that says although the gemara says that every time it says the name “Shlomo” in Shir HaShirim it refers to Hashem nevertheless you are permitted to erase it.If so what is special about two yud’s that you are only allowed to erase it “L’tzorech Gadol”? The Terumas HaDeshen says (2:171) that Tosfos says in the name of R. Chananel that you cannot erase the name of “Havaya” or of “Adnus” even if only the first two letters are written (i.e. Alef Dalet or Yud and Hey). Therefore says the Terumas HaDeshen that when there is two Yuds since the Yud is the first letter of Hashem’s name it is better not to erase. But it is permissible “L’Tzorech” because it is only one letter of Hashem’s name (not two) and it is followed by another Yud that is not part of Hashem’s name.