title: Check if column exists in linq
body: <p>I have database of external program that I want to connect and operate on through LINQ to SQL. My problem is , I want to support wider range of versions of database, so I have to check for columns if they exists.</p>
  
  <p>I tried something like that:</p>
  
  <pre><code>      IEnumerable&lt;string&gt; k = db.ExecuteQuery&lt;string&gt;("select column_name from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='{0}' and TABLE_NAME='POSIEDZENIA'", column);
  </code></pre>
  
  <p>And it gives me nothing. k.Count() gives error: </p>
  
  <blockquote>
    <p>The result of a query cannot be enumerated more than once</p>
  </blockquote>
  
  <p>When I cast it to List by ToList() it gives 0 count.</p>
  
  <p>I'm sure that this column exists in database that datacontext is connected to.</p>
  
  <p>Have you any suggestions? </p>