This is important if we not saved files on disk and SQL management studio close.
Un save file location
C:\Documents and Settings\<user name>\My Documents\SQL Server Management Studio\Backup Files\
Windows Vista/7/10
%USERPROFILE%\Documents\SQL Server Management Studio\Backup Files
OR %USERPROFILE%\AppData\Local\Temp
Sql Query find using statics
Use <Database Name> SELECT execquery.last_execution_time AS [Date Time] , execsql.text AS [Script] FROM sys.dm_exec_query_stats AS execquery CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql ORDER BY execquery.last_execution_time DESC
Query Recovery Settings
There is a setting in Management Studio that allows the Autorecover option enabled by default. We can modify the default settings as per our need to reduce the risk of loss.
Go to SSMS -> Tools -> Options -> Environment -> AutoRecover
When Application load it will popup for recovery