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 -> Save SQL script on the context menu and then select the folder in the file system.
You can also, click SQL Editor -> Save SQL script on the main menu:
To load a script stored in the file system to the SQL Editor, press CTRL+SHIFT+O, or click SQL Editor -> Load SQL script on the main menu, or right-click the script panel and click File -> Load 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 do 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 doesn't has an associated .sql file. Its contents will be lost when you close it.