If SQL Server Management Studio (SSMS) crashes for any reason at any time, then there is a chance that you will lose all the queries you have opened at the time of the crash. Sometimes when you open SSMS again So it will ask you if you want to reopen any recoverable file but for some reason it is not always ask you about that but you can recover files from below path:-

C:\Users\yourloginprofile\Documents\SQL Server Management Studio\Backup Files\Solution1