External Database Stored Procedure that drops and recreates Indexes

I am unable to perform the following using and advanced query connected to an external database

advanced query:  execute recreate_all_Indexes

procedure exists in my external database and I can run it using SQL management studio. the procedure qworks as expected.

when using advanced SQl query in out systems it says that the procedure does not exist

exact error message is
Database returned the following error:
Error in advanced query RebuildingIndexesForPerformance:Could not find stored procedure 'Recreate_All_Indexes'.

I have added execute permission to the SQL user that is assigned to the extension for the external DB, but the same error is printed

Hi Ryan,

Since you are not using any entity in the Advanced Query it does not know on what external database it needs to use.
That use case is supported but you will need to follow the instructions from the help page. As explained in the "Change the default connection" section.

João Rosado
Thanks this is now resolved :), i had to add 

/* %LogicalDatabase%=GetLogicalDatabase({Entity Name}) */