Don't add them to your main table. Create an ancillary table specifically for this purpose, using an entity-attribute-value structure:CREATE TABLE ExtraColumns (ID int NOT NULL REFERENCES MainTable(ID),AttributeName varchar(50) NOT NULL, AttributeValue varchar(100) NOT NULL, CONSTRAINT PK_ExtraColumns PRIMARY KEY(ID, AttributeName))
And yes, this is a crappy design, but it's a whole lot better than adding columns to an existing table. The GROUP BY is no big deal, and you can use PIVOT or FOR XML to reformat in a columnar presentation. This is one of those cases (IMHO, the only one really) where using XML would make (some) more sense. There's really no good way to support this kind of feature.