By default, SSMS saves your queries every 5 minutes and keeps the info for 7 days.
I suspect this has saved many a DBA when unforeseen outages occur.
One quick way to get to this recovery location is shown below and is by right clicking on a Query tab:
As you may have noticed, this provides a quick access method to your hidden AppData folder.
Previous
Next