Query Not Summing Appropriately
You seem to be making the query a lot more complicated than it needs to be, and while I agree with Erik that the results you want don't seem to make any logical sense (if you want total bills to a doctor, then why have individual rows for each patient?), here is a simpler way:

DECLARE @Startdate date = '20170101', 
        @Enddate   date = '20170131';

;WITH data AS
(
  SELECT doctorname, patientid, bill = SUM(totalbill) OVER (PARTITION BY doctorname),
    r = ROW_NUMBER() OVER (PARTITION BY doctorname ORDER BY doctorname)
  FROM @TotalBill
  WHERE vdate &gt;= @Startdate
    AND vdate &lt;  DATEADD(DAY,1,@Enddate)
)
SELECT doctorname, patientid, totalbill = COALESCE(CASE r WHEN 1 THEN bill END, 0)
FROM data;


A couple of notes:


don't use datetime for your variables when the column is date
don't use messy and unnecessary CONVERT() functions (why convert date to date?)
don't use unsafe regional formats like 'mm/dd/yyyy' - further reading
don't use BETWEEN for any range queries - further reading 


(While it's true that BETWEEN works fine for queries only involving date queries, it is far too easy to copy that logic elsewhere, where it doesn't work -
just be consistent.)

also see this post about "dating responsibly"