title: Check if column of a table has unique constraint
body: <p>I need a query which can tell me if a column of a table has unique constraint or not. If doesn't have, I have to add unique constraint. Currently I am using below query to check if a table's column has unique constraint or not:</p>
  
  <pre><code>IF NOT EXISTS (SELECT *
      FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC
      WHERE TC.CONSTRAINT_TYPE = 'UNIQUE' AND CONSTRAINT_NAME = 'IX_Product_Users' AND TABLE_NAME = 'Product_Users')
  BEGIN
      ALTER TABLE Product_Users
      ADD CONSTRAINT IX_Product_Users UNIQUE (EmpID)
  END
  GO
  </code></pre>
  
  <p>Tried this one too, but it is not able to check on which column the constraint it is:</p>
  
  <pre><code>SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
  WHERE TABLE_NAME='Product_Users' AND CONSTRAINT_TYPE = 'UNIQUE'
  </code></pre>
  
  <p>But I think this is a wrong way cause there might be possibility that unique constraint name is different. Is there any precise way to do this?</p>