I think the second part of part 2 is in error; I think it should be like this:
--Else
IF Exists (Select t.DBName, g.DBName from #TempDBSize2 t
left outer join DBGrowthRate g on T.dbname = g.DBName where g.dbname is null)
Begin
Insert into dbo.DBGrowthRate (DBName, DBID, NumPages, OrigSize, CurSize, GrowthAmt, MetricDate)
(Select tds.DBName, tds.database_ID, Sum(tds.Size) as NumPages,
Convert(decimal(10,2),(((Sum(Convert(decimal(10,2),tds.Size)) * 8000)/1024)/1024)) as OrigSize,
Convert(decimal(10,2),(((Sum(Convert(decimal(10,2),tds.Size)) * 8000)/1024)/1024)) as CurSize,
'0.00 MB' as GrowthAmt, GetDate() as MetricDate
from #TempDBSize2 tds
where tds.database_ID not in (Select Distinct DBID from DBGrowthRate
where DBName = tds.DBName)
Group by tds.database_ID, tds.DBName)
End
This will do the trick for a newly added database.