How to choose the content from a post which is in the right category?

You can use the function in_category to test if a post is in a certain category. It takes one or more categories and the post as input. So you may differentiate your function like this:

function title_content($atts, $content = null ) {
   global $wpdb;
   $post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title = %s",$content));
   $getpost = get_post($post_id);
   if (in_category('blog',$getpost)) {
       return $getpost->post_content;
       }
   else {
       ... do something else ...
       }
}