Without custom code you can do it ONLY using sql code expressions: ##ORDERBY##, ##COLUMNS##, ##TOPN##, ##WHERE##.
Take a look Loading data using custom queries. The standard approach is: you put your macros in web parts properties and they get resolved in the context of the current document.
If you really have such a need - it is possible, but it will require custom coding. You have to modify back-end code of your web part and run macroresolver on the text of your sql query, for instance:
string SQlQueryTextWithMacros= "select * from CMS_User where userName = '{%CurrentUser.UserName@%}'"
SQlQueryTextWithMacros = MacroContext.CurrentResolver.ResolveMacros(SQlQueryTextWithMacros)
DataSet ds = ConnectionHelper.ExecuteQuery(SQlQueryTextWithMacros, null, QueryTypeEnum.SQLQuery);