IF EXISTS(SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
AND OBJECT_NAME(OBJECT_ID) = 'PK_EST_PROD_PRECO_TBL_HIST_CPL'
AND OBJECT_NAME(parent_object_id) = 'EST_PROD_PRECO_TBL_HIST_CPL' )
 BEGIN 
 ALTER TABLE [dbo].[EST_PROD_PRECO_TBL_HIST_CPL] DROP CONSTRAINT [PK_EST_PROD_PRECO_TBL_HIST_CPL]
 
 ALTER TABLE [dbo].[EST_PROD_PRECO_TBL_HIST_CPL] ADD  CONSTRAINT [PK_EST_PROD_PRECO_TBL_HIST_CPL] PRIMARY KEY CLUSTERED 
 (
  [CD_EMP] ASC,
  [CD_CTR] ASC,
  [CD_PROD] ASC,
  [PERC_ICMS] ASC
 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

END
