I have found a bug in questionnaire when you use the same public survey in multiple questionnaires across different courses. I've raised it as CONTRIB-3898 and attached a patch that I think fixes it, simply be re-ordering the SQL columns so that something unique is at the start not the end.
I'd be grateful if some-one could apply this patch and double check for me that it fixes the bug and doesn't introduce any new ones?
Thanks!