you can use SMO (Sql server Management Object) by C#.
using the following library to execute this :
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
Sample Code like this :
FileInfo file = new FileInfo("ScriptFile.sql");
string script = file.OpenText().ReadToEnd();
SqlConnection conn = GetSqlConnection(); // create connection
Server server = new Server(new ServerConnection(conn));
server.ConnectionContext.ExecuteNonQuery(script);