Have you tried dynamic SQL?
Something like this:
declare @sql nvarchar(max),
@Startdate nvarchar(10),
@Enddate nvarchar(10);
set @sql = 'select * from #table1';
set @Startdate = '01/01/1900';
set @Enddate = '01/01/1900';
if @Startdate is not null and @Startdate <> ''
and @Enddate is not null and @Enddate <> ''
set @sql = @sql + ' where Startdate >= ''' + @Startdate + ''' and Enddate <= ''' +@Enddate + ''''
print @sql
exec sp_executesql @sql