The true answer is not to guess, but to know. Watch your minimap and your opponents' inventories constantly. In most games, it will be the enemy support heroes placing the majority if not all of the wards so you'll know where to focus your attention. If they are carrying wards you need to monitor their hero as much as possible and notice when that ward count drops by 1. When it does, you should know where they've been and where the common ward spots in that area are. If you've kept Observer Wards up yourself, you can determine exactly where they've placed it because doing so causes an animation. If you don't see this, you can usually narrow it down to one of a few spots and counterward appropriately. Most good counterwarding locations will reveal multiple frequently warded spots in an area- the reveal range of 950 is much larger than the vision range.

It's also worth noting that many of the common support heroes have spells that reveal high ground (allowing you to counter wards on hills or high ground that you couldn't otherwise see). AA's slow, Dazzle's ultimate, VS's howl, and others.

The other way to counterward requires a lot of experience and an expectation of high level opposition. Judging from how your opponents react to movement and gank attempts by your own team, you can tell when they've spotted someone moving between lanes and thus where they've warded. This is much more difficult and really only applicable if you're playing against competent opponents, weaker players are usally too sporadic for their reactions to be of much use. For example, I know that after a successful teamfight win in midgame by a good opposing team their supports will probably be spending the downtime placing offensive wards. With a combination of everything you've read above, I can make the chances of succesfully counterwarding worth the 100 gold chance to possibly catch a ward even if I don't know exactly where one has been placed.

As for the second part of your question, you will never really deliberately counter Sentry Wards unless it's to protect your own Observer Wards since doing so requires that the area be clear of opponents and thus their Sentry wards are unlikely to be used again anyway, they only last 3 minutes. If you really want to do so because your team is relying heavily on invisibility, a Gem is preferable because it will allow you to both reveal Sentries as you move around the map and also allow you to counter Observer Wards. This is only viable if carried by a hard to kill member of your team or the invisible hero they're countering, however. You don't want to die and give the other team the gem.

Counter-warding: how to know where wards are?
I had wrote this below stored procedure and getting incorrect statement.    

ALTER PROCEDURE dbo.[Counter]
        @TableName VARCHAR(100)
    AS 
        BEGIN
            DECLARE @Counter INT
            DECLARE @SQLQ VARCHAR(200)
            SET NOCOUNT ON;

        --SET @TableName = 'Member';
        SET @SQLQ = 'SELECT COUNT(*) FROM dbo.[' + @TableName + ']';
        --Preparing the above sql syntax into a new statement(get_counter).

            --Getting an error here I had googled the prepare statement but don't know why facing this error.
        PREPARE get_counter FROM @SQLQ;
    @Counter = EXEC get_counter; -- here @resutl gets the value of the count.@TableName
        DEALLOCATE PREPARE get_counter; -- removing the statement from the memory.


    END


Then I had wrote another one:

ALTER PROCEDURE dbo.[Counter]
    @TableName VARCHAR(100)
AS 
    BEGIN
        DECLARE @Counter INT
        DECLARE @SQLQ VARCHAR(200)
        SET NOCOUNT ON;

        --SET @TableName = 'Member';
        SET @SQLQ = 'SELECT COUNT(*) FROM dbo.[' + @TableName + ']';
        --Preparing the above sql syntax into a new statement(get_counter).


    Execute @SQLQ; -- here @resutl gets the value of the count.@TableName

        --DEALLOCATE PREPARE get_counter; -- removing the statement from the memory.
        Return @Counter;

    END


It is running fine but I can't get the result in the Counter , anyone please help me(I know that I haven't assigned any value to the counter but if I do I get error).

After your answer martin I had replace my code with yours now its :

ALTER PROCEDURE dbo.[Counter] @SchemaName SYSNAME = 'dbo' , @TableName  SYSNAME

AS
  BEGIN
      SET NOCOUNT ON;

      DECLARE @SQLQ NVARCHAR(1000)
      DECLARE @Counter INT;

      SET @SQLQ = 'SELECT @Counter = COUNT(*) FROM ' + 
       Quotename(@SchemaName) + '.' + Quotename(@TableName);

      EXEC sp_executesql
        @SQLQ ,
        N'@Counter INT OUTPUT',
        @Counter = @Counter OUTPUT

      Return   SELECT @Counter
  END 


Now I had retrieved it .

  ALTER PROCEDURE dbo.[CreateBusinessCode]
    @MemberID                               bigint,
    @len                                        int,
    @RewardAccountID                bigint,
    @ConnectionStatusID         tinyint,
    @Assign                                 smalldatetime

AS
    BEGIN
    SET NOCOUNT ON;
    DECLARE @counter INT

    EXEC @counter = dbo.Counter 'dbo','member';

    Select @counter;


    END

