TSQL create a stored procedure using c#
<p>I am trying to create a procedure(drop a procedure and remake it with new data) in my .net project. When I run the same query in Database "Create New Query" it works fine, but when I try to run it in c#, it gives me an error. </p>

<p><a href="https://i.stack.imgur.com/FMlbW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FMlbW.png" alt="This is the successful query completed when i run it on Database"></a></p>

<pre><code>private void makeprocedure()
            {
                string sqlProcedureCreate = @"
    IF(OBJECT_ID('usp_HourData') IS NOT NULL)
        DROP PROCEDURE IF EXISTS usp_HourData;
    GO

    CREATE PROCEDURE usp_HourData
    AS
    BEGIN

    SELECT Employee.[First Name] + ' ' + Employee.[Last Name] AS 'Name',
     sum(Time.[Total Hours]) AS 'Total Hours'
     , FORMAT(Time.[Time in], 'd', 'en-gb') AS 'Worked On'
     FROM Employee
     inner join Time on
     Employee.ID ='" + getID() + "' and Time.EmployeeIdFK = '" + getID()
     + "' WHERE Time.[Time in] between '" + CalendarStart.SelectedDate + "' and '" + CalendarEnd.SelectedDate
     + @"'GROUP BY FORMAT(Time.[Time in], 'd', 'en-gb') ,Employee.[First Name] + ' ' +Employee.[Last Name];
     END     
     ";
                using (SqlCommand command = new SqlCommand(sqlProcedureCreate, con))
                {
                    command.CommandType = CommandType.Text; //I tried command.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        command.ExecuteNonQuery(); //Compiler says error is on this line
                        con.Close();
                }
            }
</code></pre>

<p>The error is near "GO" and "CREATE/ALTER PROCEDURE" must go first. </p>

<pre><code>System.Data.SqlClient.SqlException was unhandled by user code
  Class=15
  ErrorCode=-2146232060
  HResult=-2146232060
  LineNumber=4
  Message=Incorrect syntax near 'GO'.
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
  Number=102
  Procedure=""
  Server=(LocalDB)\MSSQLLocalDB
  Source=.Net SqlClient Data Provider
  State=1
  StackTrace:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean&amp; dataReady)
       at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at WebApplication2.Manager.makeprocedure() in D:\Users\Albin\MyClockIn\WebApplication2\WebApplication2\Manager.aspx.cs:line 209
       at WebApplication2.Manager.ButtonSearch_Click(Object sender, EventArgs e) in D:\Users\Albin\MyClockIn\WebApplication2\WebApplication2\Manager.aspx.cs:line 161
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 
</code></pre>

<p>How would I go about this error?</p>