Drupal 7 doesn't use the '%' place holders. Try this:
$primary_key = db_query("SELECT 'COLUMN_NAME'`COLUMN_NAME` FROM 'information_schema'`information_schema`.'COLUMNS'`COLUMNS` WHERE ('TABLE_SCHEMA'`TABLE_SCHEMA` = 'mydatabase') AND ('TABLE_NAME'`TABLE_NAME` = :tbl_name) AND ('COLUMN_KEY'`COLUMN_KEY` = 'PRI')", array(':tbl_name' => $mytable));