This is a good job for common table expressions which are well suited to hierarchical data structures.
;with cte as
(
select Id as ItemId, Title as ItemTitle, CategoryId, 0 as Level
from Item
union all
select cte.ItemId, cte.ItemTitle, c.CategoryId, cte.Level + 1 as Level
from Category c
inner join cte on c.Id = cte.CategoryId
and c.CategoryId is not null
)
select ItemId, ItemTitle, c.Title as CategoryTitle
from cte
inner join Category c on c.Id = cte.CategoryId
where Level = (select Max(Level) from cte as cte1 where cte1.ItemId = cte.ItemId)