Thanks for the reply Micah, I have tried what you suggested but was unable to get it working.
I have however managed to resolve it, this is how
function exclude_category($query) {
if(!is_user_logged_in()) {
if ($query->is_main_query()) {
$cate = get_cat_id('private');
$query->set( 'cat', '-'.$cate );
}
}
}
add_action( 'pre_get_posts', 'exclude_category' );