You can save scripts to a predefined space in the currently active project or somewhere in the file system.
To save a script to the current project space, just press Ctrl+S or right-click the script and click Save on the context menu:
You can find the script saved this way in the Project Explorer view in the Scripts folder.
To save a script to the file system, right-click the script, click File -> Export SQL script on the context menu and then select the folder in the file system. You can also click SQL Editor -> Export SQL script on the main menu:
Unsaved data is highlighted in color on the left side of the editor, in addition to having an asterisk in the name of the script.
To load a script stored in the file system to the SQL Editor, press CTRL+SHIFT+O, or click SQL Editor -> Import SQL script on the main menu, or right-click the script panel and click File -> Import SQL script on the context menu:
To rename a script, right-click anywhere in the script panel, click File -> Rename SQL Script on the context menu or press CTRL+F2:
Then enter the new name in the Rename SQL script dialog box and click OK:
If you want to revert all changes made to the current SQL script and return it to its initial state (reload from disk), right-click anywhere in the script panel and click File -> Revert on the context menu.
In some cases you might want to execute a query and not save it in a script. For example, when you read table data using "Read data in SQL console" or open procedure/function source from DDL editor. SQL console does not have an associated .sql file. Its contents will be lost when you close it.