updated records into table variable in sql server code example
Example 1: sql declare table variable
DECLARE @TABLE TABLE( COL1 INT, COL2 VARCHAR(30))
Example 2: t-sql update table variale
UPDATE @searchResult
SET [record_id] = r.[record_id],
[record_name] = r.[record_name]
FROM @searchResult SR
CROSS APPLY (
SELECT TOP 1 *
FROM [records]
WHERE [record_name] LIKE [name_template] -- Your wish, but do you really need LIKE matching??
ORDER BY [record_id] DESC
) AS r;