I did give a try to ChatGPT about explaining SQL Code. Guthub Copilot is probably based on ChatGPT but more optimized at dealing with coding problems.
It can explain the basis of SQL coding inside your procedure, especially when dealing with SQL metadata views or functions.
But it can’t explain the business rules you are processing, in your query, and you could not expect ChatGpt neither Copilot to do so. It uses cleverly the comments that are already there to infer more explanations.
I also tried to push it to adopt a programming pattern for queries. It was tough to get the whole function right as I want. In the end, it explained nicely what I was trying to communicate to him. Due to lack of time, I couldn’t ask him to write another function using the same pattern, so I didn’t know if it really learned.
What is interesting also, is that it writes some fancy skeleton code.