1UPDATE @searchResult
2SET [record_id] = r.[record_id],
3 [record_name] = r.[record_name]
4FROM @searchResult SR
5CROSS APPLY (
6 SELECT TOP 1 *
7 FROM [records]
8 WHERE [record_name] LIKE [name_template] -- Your wish, but do you really need LIKE matching??
9 ORDER BY [record_id] DESC
10) AS r;