OUTER APPLY (
SELECT TOP 1 t.TagName
FROM ' + quotename(name) + '.dbo.PostTags AS pt
INNER JOIN ' + quotename(name) + '.dbo.Tags AS t
ON pt.TagId = t.Id
WHERE pt.PostId = p.Id
AND (t.TagName LIKE ''status-%''
OR t.TagName LIKE ''estado-%''
OR t.TagName LIKE ''完了''
OR t.TagName LIKE ''статус-%'')
) t