Recent post by custom select query

The function you have posted uses a nasty custom SQL query which is really not necessary and adding a category filter to it would make it even worse, you can do all of the filters using WP_Query object or get_posts except the exclusion of password protected posts which can be done with a simple function hooked to posts_where filter so here you go:

//function to exclude password protected posts
function exclude_pw_where($where) {
    $where .= " AND post_password = '' ";
    return $where;
}

// function to get latest posts of category
function latest_posts_of_category($no_posts = 5, $before="<li>", $after="</li>", $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false, $include_pages = false, $cat_id = null){
    global $post;
    $temp = $post;
    $args = array(
        'posts_per_page' => $no_posts,
        'post_type' => 'post',
        'post_status' => 'published',
        'order' => 'DESC',
        'orderby' => 'date',
        'offset' => $skip_posts,
    );

    if ( $cat_id != null )
        $args['cat'] = $cat_id;     

    if ( $include_pages )
        $args['post_type'] = array('post','page');

    //add filter to exclude password protected posts
    if ( $hide_pass_post )
        add_filter('posts_where', 'exclude_pw_where');

    $posts = get_posts($args);
    if ( $posts ) {
        foreach ( $posts as $post ) {
            $post_title = $post->post_title;
            $permalink = get_permalink( $post->ID );
            $date=date('F j, Y', strtotime($post->post_date));
            $output .= $before . '<span class="date">'.$date.'</span><a href="' . esc_url( $permalink ) . '" rel="bookmark" title="Permanent Link: ' . esc_attr( $post_title ) . '">' . esc_html( $post_title ) ;
            if ( $show_excerpts ) {
                $post_excerpt = esc_html( $post->post_excerpt );
                $output.= '<br />' . $post_excerpt;
            }
            $output .= $after;
        }
    } else {
        $output .= $before . "None found" . $after;
    }
    echo $output;

    //remove the filter if was called
    if ( $hide_pass_post )
        remove_filter('posts_where', 'exclude_pw_where');

}

it does the same thing but in a much safer way and you can set the last parameter $cat_id to specify a category (or a list of categories using an array) by the category id.