title: Check if column exists before execute select clause
body: <p>I use a <code>DataTable</code> in a foreach loop from sql like:</p>
  
  <pre><code> foreach(var i in tasks)
   {
       // query sql
       var timeOfTasks = db.GetTableBySQL($"exec usp_Get_WorkedProyectTime @TaskTypeCategoryId = '{i.TaskTypeCategoryId}', @TaskId= '{i.TaskId}'");
  
       // read columns (different rows have different columns)
       var progressToBackCheck = (from DataRow dr in timeOfTasks.Rows select dr["ProgressToBackCheck"]).FirstOrDefault();
       var backcheckToCorrection = (from DataRow dr in timeOfTasks.Rows select dr["BackcheckToCorrection"]).FirstOrDefault();
       var correctionsToCompleted = (from DataRow dr in timeOfTasks.Rows select dr["CorrectionsToCompleted"]).FirstOrDefault();
       var progressToCompleted = (from DataRow dr in timeOfTasks.Rows select dr["ProgressToCompleted"]).FirstOrDefault();
   }
  </code></pre>
  
  <p>Not all task results have the same data rows. And each row doesn't contain all fields. Is there a way to check if a column exists in the result, before I use query for it?</p>