I think Toad for SQL Server (60 days freeware trial version from Quest software) includes this feature.
You can avoid losing unsaved queries by clearing the checkbox "Do not prompt for unsaved files on closure" in the QA options
A product called Aqua Data Studio stores out a history of queries.
It works with both Oracle and MS SQL .
I have been working with their demo a little bit ; price is reasonable
Instead of figuring out how to find the last unsaved executed query in SQL QA, I started using Teradata SQL Assistant tool which can be used against most of the databases and stores all the queries in a history file. The cool thing about this tool is that history file is displayed right in this analyzer in a tabular format and you can just select and also search on whatever previous queries you might have executed.
Thanks to all for your suggestions.