Create a form, add a text box, add a button, enter the sql statement in the text box, execute the sql statement when the button is clicked, and display the execution result in the form,

There are the following requirements:
Create a form, add a text box, add a button, enter the sql statement in the text box, execute the sql statement when the button is clicked, and display the execution result in the form,
Can such a demand be achieved?

It currently can be achieved, but Microsoft plans to prevent it, because it’s extremely dangerous.
The right course of actions would be asking the client about the actual business requirements and then suggest a better solution.

This is our business requirement, can you tell me how to achieve it ?

No, this isn’t a business requirement. This is a particular technical solution.
If this is all you know, you must ask users to forget their ideas about implementation for a moment and explain why they want to do such a thing. What they want to achieve from the business point of view? What problem are they trying to solve?