The following steps may be helpful:
You can try the settings tab. The environment depends on the type of database design. In one of my projects, I have the tab "Project Settings", where it gives me the opportunity to create an SQL script (see the figure below) 
Or in other editions of Visual Studios
1. Open the project / solution and right-click the project and select "Properties" or double-click the "Properties" folder
2. A new window appears in your environment indicating all the properties of the project. Now go to the maximize tab
3. In the "Deployment Action" section, select "Create Deployment Script (.sql)" from the drop-down list.
4. Click the save button and close this window.
5. From the Build menu, select Create Solution, and then select Expand [Solution Name]
6. After the script is deployed, it should be available in the SQL-debug folder,
for example: [path to my project] \ sql \ debug \ script.sql
source share