Querying an enormous table (~150 million rows) with multiple joins - SQL Server
Try running the cases seperately.  If that's faster you can work on combining them into one query.  eg something like the not strictly-equivilent:

SELECT rt.VehicleID,rt.PersonalAutoCovID,SUM(CAST(rd.OutputValue AS INT)) VehicleScore
FROM #RatingDataTemp1 rt
INNER JOIN modelingdata md 
    ON md.BranchID = rt.BranchID
    AND (rt.EditEffectiveDate &gt;= md.EffectiveDate )
    AND (rt.EditEffectiveDate &lt; md.ExpirationDate )
GROUP BY rt.VehicleID,rt.PersonalAutoCovID


and

SELECT rt.VehicleID,rt.PersonalAutoCovID,SUM(CAST(rd.OutputValue AS INT)) VehicleScore
FROM #RatingDataTemp1 rt
INNER JOIN modelingdata md 
    ON md.BranchID = rt.BranchID
    AND md.EffectiveDate is null
    AND md.ExpirationDate IS NULL
GROUP BY rt.VehicleID,rt.PersonalAutoCovID


And if the target date range is small, consider changing the #RatingDataTemp1 to have one row per day per BranchID and doing a straight inner join on both columns.