We are using the bulk set of sql script in a sql file and load that file during runtime to text variable in C#. Hence I execute the following query through Oledb Connection and Command type
as "Text". Unfortunatly It was given the following error.

```
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Incorrect syntax near 'GO'.

```

SQL Query Syntax

```
  IF exists  (
                SELECT  '1' 
                FROM    sysobjects 
                WHERE   id = object_id(N'SP_Name')  
                and     objectproperty(id, N'isprocedure') = 1
               )
    BEGIN
        DROP PROC SP_Name 
    END
    GO
    Create PROCEDURE SP_Name 
     (  
       @var_id NUMERIC(10),
       @var_id1 NVARCHAR(100),
       @var_id_Out1     numeric(10)     output,
       @var_id_Out2     integer         output,
       @var_id_Out3     nvarchar(2000)  output
    )  
    WITH ENCRYPTION  
    AS  
    BEGIN  
    SET NOCOUNT ON  
        select * from demotable
    SET NOCOUNT OFF  
    END 
    GO

GRANT   EXEC ON SP_Name TO PUBLIC
GO

```

C# Code snippet

```
OleDbCommand cmd;
OleDbConnection co = new OleDbConnection("Provider=SQLOLEDB;Data Source=servername;Database=DB_Name;User Id=sa;Password=mypass;");
co.Open();
String[] strFileList = Directory.GetFiles(@"D:\Procedure");
String conntent = null;
foreach (string commandSP in strFileList)
{
       conntent = File.ReadAllText(commandSP);
       cmd = co.CreateCommand();
       cmd.CommandText = conntent;     
       cmd.ExecuteNonQuery();
}
co.Close();

```