There are situations when you have very large .sql files and you want to execute them. The issue comes when you have to open those files in SSMS. They start giving out of memory exceptions. The solution is to use sqlcmd utility to run the same. You can execute them like below:
sqlcmd -S localhost -d master -i "C:\Software\script.sql" -a 32767 -o "C:\Software\scriptslog.txt"
Following is the location where you can find that tool: