• As mentioned, there's no native way to do this. There are a number of products, including those from my employer, Red Gate, that can help.

    These tabs are like files in notepad or Word. If you don't save them, they're gone. I typically save them quickly when I think I might use the code. I also sometimes drop a bunch of code in one large query1.sql file, commenting bits out, but keeping a scratchpad.