is this a subset of a larger script? why the dynamic SQL?
also, since you drop and recreate the table every time, why not a temp table?
why create the table in advance? why not just use INSERT ... INTO and build the table on the fly completely?
SET @InsertSQL = 'SELECT identity(int,1,1) As ID,* INTO Hosea_tempTable FROM '
+ @TableName
+ ' WHERE (Product_Id = '''
+ @Product_Id
+ ''' or Product_Id = '''') AND (Fund_Id = '''
+ @Fund_Id
+ ''' or Fund_Id is null)';
Lowell