How to recover the unsaved scripts if the SSMS crashes / unsaved tab gets accidentally closed?
You can find files here, when you closed SSMS window accidentally
C:\Windows\System32\SQL Server Management Studio\Backup Files\Solution1