Du kan bruge CTE for at få alle månedens sidste dage inden for det definerede interval
Declare @Start datetime
Declare @End datetime
Select @Start = '20130808'
Select @End = '20131111'
;With CTE as
(
Select @Start as Date,Case When DatePart(mm,@Start)<>DatePart(mm,@Start+1) then 1 else 0 end as [Last]
UNION ALL
Select Date+1,Case When DatePart(mm,Date+1)<>DatePart(mm,Date+2) then 1 else 0 end from CTE
Where Date<@End
)
Select * from CTE
where [Last]=1 OPTION ( MAXRECURSION 0 )