If for some reasons SQL server instance dies or it crashes and if you had an unsaved query - you could still recover it from the backup files that sql server creates whenever it crashes unexpectedly.
The path for the backup .sql files is something like the following -
C:\Users\USER_PROFI\Documents\SQL Server Management Studio\Backup Files\Solution1