How to build query with dynamic columns for multiple clients

Hello.

I am working on common component. I have 2 different masters at project level (details not in this body).
I have below tables structures.

1. ColumnMaster :- ColumnId, ColumnName
2. ClientMaster :- ClientId, ClientName
3. ClientColMapping :- Id, ClientId, ColumnId, MasterTablesName, MasterColumnName
4. MappingTable :- Id, ReqName, Column1, Column2............, Column10.

Now, I given provision to use 10 master tables records which user can use in where condition.
In 1st table, I have 10 rows column1, 2,3,4....10
In 2nd table, I have 1 record (as per client count)
In 3rd table, I have mapping of client and column. Means, here client can set number of input parameters to get specific record. Let say client have 2 masters. It means client use column1 and column2 which is mapped with Grade master and level masters in 3rd table.
In 4th table, we inserted record from back end. Now, client passing GradeId and LevelId in where condition. but my table is having column1, column2. Mapping of my columns and clients columns is available in 3rd table.
Now, my query is, how to build dynamic query according to column mapping.