--For running SQL Query using Power Query, Go to Data Tab, Get Data, From Other Sources, Blank Query, then in query window click on Advanced Editor and use below syntax as per need.
let
Source = Sql.Database("ServerName", "DatabaseName", [Query=" Select ID, personname from abc..person where ID= 306258"])
in
Source
And if we want to use Query syntax from Excel file where it is available as a named range then use below syntax. Please note the QueryValue in below syntax is a named range cell where query is available
let
Source = Sql.Database("ServerName", "DatabaseName", [Query= Excel.CurrentWorkbook(){[Name="QueryValue"]}[Content]{0}[Column1]])
in
Source