procedure for postgres to create table if not exist
Just use CREATE TABLE [IF NOT EXISTS]

Looks like this,

CREATE TABLE IF NOT EXISTS test (
  the_id  int   PRIMARY KEY,
  name    text
);


If you must wrap it in a function (don't though, there is no point),

CREATE FUNCTION myCreateTable() RETURNS void AS $$
  CREATE TABLE IF NOT EXISTS test (
    the_id  int   PRIMARY KEY,
    name    text
  );
$$ LANGUAGE sql
VOLATILE;


If you want that function to accept a name (still wouldn't suggest this),

CREATE OR REPLACE FUNCTION myCreateTable(myIdent text) RETURNS void AS $$
  BEGIN
    EXECUTE format(
      '
        CREATE TABLE IF NOT EXISTS %I (
          the_id  int   PRIMARY KEY,
          name    text
        );
      ',
      myIdent
    );
  END;
$$ LANGUAGE plpgsql
VOLATILE;


[ IF NOT EXISTS ] has been in PostgreSQL since 9.1