Power Query M code
let
Source = YourTable,
ColumnsToRemove = List.Select(Table.ColumnNames(Source), each Text.Contains(_, "_temp")),
Removed = Table.RemoveColumns(Source, ColumnsToRemove)
in
Removed
Removes every column whose name contains a given text pattern, instead of listing columns by exact name.
let
Source = YourTable,
ColumnsToRemove = List.Select(Table.ColumnNames(Source), each Text.Contains(_, "_temp")),
Removed = Table.RemoveColumns(Source, ColumnsToRemove)
in
Removed
Change "_temp" to whatever substring identifies the columns you want dropped.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Remove Columns by Name Pattern.