Q. Is there a source in Chazal for the ceremony of placing a cornerstone before building an institution or a shul?

A. Horav Shlomo Miller Shlit’a pointed to the posuk in Zecharya (4: 9) “Zerubbabel’s hands founded (yisdu) this house, and his hands shall complete [it].” The same term is used in Melachim (1: 16: 24) “During his days, Hiel the Bethelite built Jericho; with Abiram his firstborn, he laid its foundation (yisdo).” Rashi explains: “When he laid its foundation, his firstborn son died… Now, these were Joshua’s curses, with [the loss of] his firstborn shall he lay its foundation, (yisadena)” (Yehoshua 6:26).
You find also the date for placing the cornerstone (Melachim 1: 6: 37) “In the fourth year was the foundation of the house of Hashem laid, in the month of Ziv.”
In Ezra (3: 10,11) the solemnities and festivities of the cornerstone foundation of the Second Temple are described: “And the builders laid (vayisdu) the foundation of the Temple of Hashem, and they stationed the Cohanim in their attire with trumpets, and the Leviyim, the sons of Asaf, with cymbals, to praise Hashem through Dovid the King of Israel. And they sang aloud with praise and with thanks to Hashem for He is good, for His kindness is eternal over Israel, and the entire people shouted with a great shout with praise to Hashem because the foundation of the House of Hashem was laid.” (See also Chagai 2: 15,18).
On the Posuk (Zecharya 3: 9) “For, behold the stone that I have placed before Yehoshua. Seven eyes are directed to one stone,” Rashi explains: “The foundation of the house that you laid in the days of Cyrus – they stopped you, and that foundation and the thickness of the wall appeared little in your sight….It will eventually be widened seven times as much.” See also S’forno and Radak (ibid.) that it is a reference to the foundation’s cornerstone.
It is by now a broadly spread tradition to carry out such dedication ceremonies, as is evident from the recorded Divrei Torah, discourses and addresses said by many Gedolim on such occasions. See Even Sapir (Mishlei 14) who quotes a story on the laying of the cornerstone of the yeshiva of the Maharsho and the great importance of the act.
The Rov’s opinion is that there is ample basis for the ceremonies done when beginning the construction of a Torah institution or a shul and dedicating the cornerstone, since it also helps to attain the necessary funds.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a