use a calendar table like
http://visakhm.blogspot.in/2010/02/generating-calendar-table.html
then do query like
SELECT f.[Date],t.cnt
FROM dbo,CalendarTable(@StartDate,@EndDate,0,1)f
CROSS APPLY (SELECT COUNT(*) AS cnt
FROM table
WHERE f.[Date]>= startDate
AND (f.[Date] <= endDate OR endDate IS NULL)
)t
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/