That's precisely the sort of thing dynamic queries are meant for.
DECLARE @Search1 NVARCHAR(200);
DECLARE @Search2 NVARCHAR(200);
SET @Search1 = '1673437';
SET @Search2 = 'SSN';
DECLARE @SearchColumn sysname;
SELECT
@SearchColumn = QUOTENAME(name)
FROM
sys.columns
WHERE
name = @Search2
And
object_id = OBJECT_ID(N'Persons')
;
DECLARE @command nvarchar(max);
SET @command = N'SELECT TOP 10 ID, FirstName, LastName, Age FROM Persons WHERE ' + @SearchColumn + N' = @Search1';
EXEC sp_executesql @command, N'@Search1 nvarchar(200)', @Search1 = @Search1;
sp_executesql (Transact-SQL) | Microsoft Docs[
^]
If for some bizarre reason you can't, or don't want to, use a dynamic query, then your only option is a separate check for every possible column:
SELECT TOP 10
ID,
FirstName,
LastName,
Age
FROM
Persons
WHERE
(@Search2 = N'SSN' And SSN = @Search1)
Or
(@Search2 = N'FirstName' And FirstName = @Search1)
Or
...