As I explained in previous answer:
How to create new table on every drop down list item select[
^] this is most likely a really bad thing to do.
However, if you really need to do this for some reason you must make sure that every column is named differently. So build the ALTER TABLE command dynamically and execute it. Something like
declare @command nvarchar(max)
declare @dates int, @StartDate datetime, @EndDate datetime
Select @StartDate = convert(datetime, '1/7/2015'), @endDate = convert(datetime,'1/10/2015')
select @dates = datediff (dd,@StartDate ,@Enddate)
While (@dates >0) begin
set @command = 'alter table demotable add [Columnname' + cast(@dates as nvarchar(max)) + '] datetime'
exec sp_executesql @command
select @dates = @dates - 1
end
But as said this design will probably cause problems in the future.