title: Check if an index exists on table column
body: <p>I have a index defined on a one single column of a table. I am using the following query to determine whether the index exist on one column or not. This seems to work but is there a better way to do this? I looked at other solutions on stackoverflow but that does not seem to work well.</p>
  
  <pre><code>    SELECT MIN(ColumnsCount) FROM 
      (
      SELECT COUNT(*)  AS ColumnsCount, 
              SysIndex.name
      FROM sys.indexes As SysIndex
          Inner Join sys.index_columns As SysIndexCol On SysIndex.object_id = SysIndexCol.object_id And SysIndex.index_id = SysIndexCol.index_id 
          Inner Join sys.columns As SysCols On SysIndexCol.column_id = SysCols.column_id And SysIndexCol.object_id = SysCols.object_id  
      WHERE SysIndex.name 
      in 
      (
       Select 
          SysIndex.name
      From 
          sys.indexes As SysIndex
          Inner Join sys.index_columns As SysIndexCol On SysIndex.object_id = SysIndexCol.object_id And SysIndex.index_id = SysIndexCol.index_id 
          Inner Join sys.columns As SysCols On SysIndexCol.column_id = SysCols.column_id And SysIndexCol.object_id = SysCols.object_id 
      Where 
          type &lt;&gt; 0 
          And SysIndex.object_id in (Select systbl.object_id from sys.tables as systbl Where SysTbl.name = 'TableName')
          And SysCols.name = 'ColName'
      ) 
      GROUP BY SysIndex.name) A
  </code></pre>