Detecting jQuery UI version in module
If you call drupal_add_js() without parameters it will return an array of all the JavaScript already installed. You can iterate over the elements to look for the jQuery UI version you need. For example

  $installed_js = drupal_add_js();
  foreach ($installed_js as $file =&gt; $details) {
    if (preg_match('/jquery\.ui/', $file)) {
      $version = $details['version'];
      break;
    }
  }
  list($major, $minor, $update) = explode('.', $version);
  if ($major != '1' &amp;&amp; $minor != '12' &amp;&amp; $update != '1') {
    // Add drupal_add_js call here
  }


You might need a more robust regex to check for a wider variety of possible filenames but the above code should work in principle. I should also point out, it's not totally robust - if for some bizarre reason the file was named blah.js, this approach would not find it, so your module's jQuery code should also check to make sure the right version is loaded.