DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE SomeTable DROP CONSTRAINT DF_SmoeTable_ColName';
BEGIN TRY
EXEC sp_executesql @sql;
END TRY
BEGIN CATCH
IF ERROR_NUMBER() = 1785 -- Constraint does not exist
PRINT 'Constraint DF_SmoeTable_ColName does not exist.';
ELSE
RAISERROR('An error occurred while dropping the constraint.', 16, 1);
END CATCH;
Try this code ,its going to work.
This code initially generates a SQL statement dynamically in order to remove the constraint. It proceeds to execute the statement by using a TRY...CATCH block. If the restriction is not present, an ERROR_NUMBER() of 1785 will be triggered, resulting in the display of a message. If a different mistake happens, it will result in an error being raised.
In this manner, you can try removing the restriction without concern for errors in case it is not present. If necessary, additional constraint names can be added to the @sql variable for adjustment.