You need to do this with dynamic SQL, I think.
CREATE PROCEDURE _InsertAttbts @Attribute VARCHAR(100)
AS
BEGIN
IF NOT EXISTS (SELECT * FROM dbo.Attributes WHERE Attribute = @Attribute)
BEGIN
INSERT INTO dbo.Attributes(Attribute)
VALUES(@Attribute);
declare @sql nvarchar(max) = 'ALTER TABLE PRODUCTS ADD '+@Attribute+' varchar(100)';
exec sp_executesql @sql;
END;
END;
I have no idea why you want to do this. You can get the list of columns using INFORMATION_SCHEMA.COLUMNS
or one of the system tables.