cmd.CommandTimeout = 300; // seconds cmd.ExecuteNonQuery();
In the stored procedure, use local variables or OPTION (RECOMPILE) :
using (SqlCommand cmd = new SqlCommand(sql, conn))