The QE won't pick up sql that is passed in as variable. It's a regular expression based parser, and it has no way of evaluating the code, so if all you have for a query is a variable name like $sql, it won't be able to figure out the query. To get around this, I've always done prep work to move the queries inline if possible so that the QE will be able to automatically extract them. The QE is not 100% reliable, so you have to expect to have to handle some of the queries manually.
As far as the other problem, the QD relies on information provided by proc_doc, which is an alias for ad_proc, so you need to declare all of the procs with either proc_doc (which is deprecated) or ad_proc. CMS, CR, and templating did not use either proc_doc, or ad_proc, so I had to go change all of the proc delcarations before running the QE. I imagine that there might be quite a few other modules that need this type of prep work before running the QE.