SQL Framework (part of HTML Library bundle) is designed for creating, parsing and modifying SQL queries based on database schema. You can easily add new field from existing or new table, change order/group parts, convert where conditions to joins, add/remove where conditions and much more.
Please check https://delphihtmlcomponents.com/SQLLibrary.pdf