Selecting columns in a SQL statement

I currently have a Shiny application that extracts data from a Teradata database. The SQL extracts all columns (SELECT *) from the database. My intent is to give the user the option to extract only columns they need.

The server code is currently coded as below:

If (input$views == "DB_TRAN") {
tb = dbGetQuery (conn, Paste0("
select *
from table a
where tran_dt between ' ", input$datarange3[[1]], " '
and ' "input$datarange3[[2]], " '
"))
}

I've updated the UI so it has the columns listed for the user to select. Sample code is below:

UI
CheckboxGroupInput(
"Columns",
"Choose columns to download",
choices = c("column1",
"column2"),
selected = c("column1",
"column2")
)

My question is how do update the Server code so it extracts the columns the user selects?