Dynamic data comparison from database table. I want to retrieve the database column values dynamically from the table

In this code snippet I need to fetch data from the table for specific column which may have values like passsd,paaswd.cpy,ABC, DEF and so on. How is it possible to store it dynamically and getting he values.

Can you clarify what you mean by “store it dynamically?”