You can access the execution plan using SQL functions, and retrieve the output in XML format.
To access the short plan, see EXPLANATION function [Miscellaneous].
To access the long plan, see PLAN function [Miscellaneous].
To access the graphical plan, see GRAPHICAL_PLAN function [Miscellaneous].