Paul, please keep questions on one issue in one thread in the future. The issue is still the aliasing. When you get that error in Query Analyzer or SMSS, double click it. It will bring you right to Line 102 where you have:
UPDATE @EntityDateTimes
SET EventID=(SELECT TOP 1 EventID
FROM tkEntityHistory )
WHERE EntityID=@EntityDateTimes.EntityID
AND [DateTime]=@EntityDateTimes.[DateTime])
You cannot use Fully qualified names with Table variables.
This needs to be:
UPDATE @EntityDateTimes
SET EventID=(SELECT TOP 1 EventID
FROM tkEntityHistory
WHERE EntityID=E.EntityID
AND [DateTime]=E.[DateTime])
FROM @EntityDateTimes E