Generally you do not inject user input directly into SQL statements like that, since it would make your code vulnerable to sql injection attacks. If you are using python to perform SQL query, the standard mysql.connector library provides relatively safer way of performing queries based on user input.
Since selection_option_heading_1 is a column name, it would be best to check if such a column exists before querying it.
An example would be :
SQL_col_query = "SELECT * FROM information_schema.columns
WHERE table_schema = 'your_schema'
AND table_name = books"
cur.execute(SQL_col_query)
column_names = [row[0] for row in cur.fetchall()]
if ( selection_option_heading_1 in column_names) :
SQL_query = f"SELECT isbn, title, author, year FROM books WHERE {selection_option_heading_1} ILIKE %S LIMIT 50"
data = (selection_option_heading_1 , search_string_1 )
cur.execute(SQL_query , data)
...
This is definitely a safer alternative to what you are doing, but I wouldnt be clear if it is the best way to perform such queries.